Technical Q&As


QTW 77 - Disabling Windows Screen Savers (14-May-96)


Q My Windows application includes a QuickTime movie that runs about 4 minutes. Some of my Windows users have their screen saver set to kick-in in 2 or 3 minutes. When this time period has elapsed, the screen saver covers up the movie being played. To get rid of the screen saver and display the movie again, they must move the mouse or hit a key. Is there a way to inform Windows that a process is going on so that the screen saver won't kick in?

AYes, a Windows application can prevent the screen saver from kicking in. The solution is to process the system WM_SYSCOMMAND message. If the wParam is equal to SC_SCREENSAVE, returning a non-zero value prevents the screen saver from kicking in:

   switch (message) {
      ...
      case WM_SYSCOMMAND:
         if (wParam==SC_SCREENSAVE) return 1;  // Screen Saver off
         break;
   }
Or more simply:

   // Disable Screen Saver
   if ((message==WM_SYSCOMMAND) && (wParam==SC_SCREENSAVE)) return 1;

   switch (message) {
      ...
   }


Technical Q&As
Previous Question | Contents | Next Question